﻿namespace VAdvantage.Model
{

    /** Generated Model - DO NOT CHANGE */
    using System;
    using System.Text;
    using VAdvantage.DataBase;
    using VAdvantage.Common;
    using VAdvantage.Classes;
    using VAdvantage.Process;
    using VAdvantage.Model;
    using VAdvantage.Utility;
    using System.Data;
    using VAdvantage.Model;
    /** Generated Model for Fact_Acct_Balance
     *  @author Jagmohan Bhatt (generated) 
     *  @version Vienna Framework 1.1.1 - $Id$ */
    public class X_Fact_Accumulation : PO
    {
        public X_Fact_Accumulation(Context ctx, int Fact_Accumulation_ID, String trxName)
            : base(ctx, Fact_Accumulation_ID, trxName)
        {
            /** if (Fact_Accumulation_ID == 0)
            {
            SetBalanceAccumulation (null);	// M
            SetC_AcctSchema_ID (0);
            SetFact_Accumulation_ID (0);
            SetIsActivity (true);	// Y
            SetIsBudget (true);	// Y
            SetIsBusinessPartner (true);	// Y
            SetIsCampaign (true);	// Y
            SetIsDefault (false);	// N
            SetIsLocationFrom (true);	// Y
            SetIsLocationTo (true);	// Y
            SetIsProduct (true);	// Y
            SetIsProject (true);	// Y
            SetIsSalesRegion (true);	// Y
            SetIsUserElement1 (true);	// Y
            SetIsUserElement2 (true);	// Y
            SetIsUserList1 (true);	// Y
            SetIsUserList2 (true);	// Y
            }
             */
        }
        public X_Fact_Accumulation(Ctx ctx, int Fact_Accumulation_ID, String trxName)
            : base(ctx, Fact_Accumulation_ID, trxName)
        {
            /** if (Fact_Accumulation_ID == 0)
            {
            SetBalanceAccumulation (null);	// M
            SetC_AcctSchema_ID (0);
            SetFact_Accumulation_ID (0);
            SetIsActivity (true);	// Y
            SetIsBudget (true);	// Y
            SetIsBusinessPartner (true);	// Y
            SetIsCampaign (true);	// Y
            SetIsDefault (false);	// N
            SetIsLocationFrom (true);	// Y
            SetIsLocationTo (true);	// Y
            SetIsProduct (true);	// Y
            SetIsProject (true);	// Y
            SetIsSalesRegion (true);	// Y
            SetIsUserElement1 (true);	// Y
            SetIsUserElement2 (true);	// Y
            SetIsUserList1 (true);	// Y
            SetIsUserList2 (true);	// Y
            }
             */
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_Fact_Accumulation(Context ctx, DataRow rs, String trxName)
            : base(ctx, rs, trxName)
        {
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_Fact_Accumulation(Ctx ctx, DataRow rs, String trxName)
            : base(ctx, rs, trxName)
        {
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_Fact_Accumulation(Ctx ctx, IDataReader dr, String trxName)
            : base(ctx, dr, trxName)
        {
        }
        /** Static Constructor 
         Set Table ID By Table Name
         added by ->Harwinder */
        static X_Fact_Accumulation()
        {
            Table_ID = Get_Table_ID(Table_Name);
            model = new KeyNamePair(Table_ID, Table_Name);
        }
        /** Serial Version No */
        static long serialVersionUID = 27581088216420L;
        /** Last Updated Timestamp 3/1/2011 12:31:39 PM */
        public static long updatedMS = 1298962899631L;
        /** AD_Table_ID=1068 */
        public static int Table_ID;
        // =1068;

        /** TableName=Fact_Accumulation */
        public static String Table_Name = "Fact_Accumulation";

        protected static KeyNamePair model;
        protected Decimal accessLevel = new Decimal(2);
        /** AccessLevel
        @return 2 - Client 
        */
        protected override int Get_AccessLevel()
        {
            return Convert.ToInt32(accessLevel.ToString());
        }
        /** Load Meta Data
        @param ctx context
        @return PO Info
        */
        protected override POInfo InitPO(Context ctx)
        {
            POInfo poi = POInfo.GetPOInfo(ctx, Table_ID);
            return poi;
        }
        /** Load Meta Data
        @param ctx context
        @return PO Info
        */
        protected override POInfo InitPO(Ctx ctx)
        {
            POInfo poi = POInfo.GetPOInfo(ctx, Table_ID);
            return poi;
        }
        /** Info
        @return info
        */
        public override String ToString()
        {
            StringBuilder sb = new StringBuilder("X_Fact_Accumulation[").Append(Get_ID()).Append("]");
            return sb.ToString();
        }

        /** BalanceAccumulation AD_Reference_ID=481 */
        public static int BALANCEACCUMULATION_AD_Reference_ID = 481;
        /** Daily = D */
        public static String BALANCEACCUMULATION_Daily = "D";
        /** Calendar Month = M */
        public static String BALANCEACCUMULATION_CalendarMonth = "M";
        /** Period of a Vienna Calendar = P */
        public static String BALANCEACCUMULATION_PeriodOfAViennaCalendar = "P";
        /** Calendar Week = W */
        public static String BALANCEACCUMULATION_CalendarWeek = "W";
        /** Is test a valid value.
        @param test testvalue
        @returns true if valid **/
        public bool IsBalanceAccumulationValid(String test)
        {
            return test.Equals("D") || test.Equals("M") || test.Equals("P") || test.Equals("W");
        }
        /** Set Balance Accumulation.
        @param BalanceAccumulation Balance Accumulation Type */
        public void SetBalanceAccumulation(String BalanceAccumulation)
        {
            if (BalanceAccumulation == null) throw new ArgumentException("BalanceAccumulation is mandatory");
            if (!IsBalanceAccumulationValid(BalanceAccumulation))
                throw new ArgumentException("BalanceAccumulation Invalid value - " + BalanceAccumulation + " - Reference_ID=481 - D - M - P - W");
            if (BalanceAccumulation.Length > 1)
            {
                log.Warning("Length > 1 - truncated");
                BalanceAccumulation = BalanceAccumulation.Substring(0, 1);
            }
            Set_Value("BalanceAccumulation", BalanceAccumulation);
        }
        /** Get Balance Accumulation.
        @return Balance Accumulation Type */
        public String GetBalanceAccumulation()
        {
            return (String)Get_Value("BalanceAccumulation");
        }
        /** Get Record ID/ColumnName
        @return ID/ColumnName pair */
        public KeyNamePair GetKeyNamePair()
        {
            return new KeyNamePair(Get_ID(), GetBalanceAccumulation().ToString());
        }
        /** Set Accounting Schema.
        @param C_AcctSchema_ID Rules for accounting */
        public void SetC_AcctSchema_ID(int C_AcctSchema_ID)
        {
            if (C_AcctSchema_ID < 1) throw new ArgumentException("C_AcctSchema_ID is mandatory.");
            Set_Value("C_AcctSchema_ID", C_AcctSchema_ID);
        }
        /** Get Accounting Schema.
        @return Rules for accounting */
        public int GetC_AcctSchema_ID()
        {
            Object ii = Get_Value("C_AcctSchema_ID");
            if (ii == null) return 0;
            return Convert.ToInt32(ii);
        }
        /** Set Calendar.
        @param C_Calendar_ID Accounting Calendar Name */
        public void SetC_Calendar_ID(int C_Calendar_ID)
        {
            if (C_Calendar_ID <= 0) Set_Value("C_Calendar_ID", null);
            else
                Set_Value("C_Calendar_ID", C_Calendar_ID);
        }
        /** Get Calendar.
        @return Accounting Calendar Name */
        public int GetC_Calendar_ID()
        {
            Object ii = Get_Value("C_Calendar_ID");
            if (ii == null) return 0;
            return Convert.ToInt32(ii);
        }
        /** Set Description.
        @param Description Optional short description of the record */
        public void SetDescription(String Description)
        {
            if (Description != null && Description.Length > 255)
            {
                log.Warning("Length > 255 - truncated");
                Description = Description.Substring(0, 255);
            }
            Set_Value("Description", Description);
        }
        /** Get Description.
        @return Optional short description of the record */
        public String GetDescription()
        {
            return (String)Get_Value("Description");
        }
        /** Set Balance Aggregation.
        @param Fact_Accumulation_ID Balance Aggregation */
        public void SetFact_Accumulation_ID(int Fact_Accumulation_ID)
        {
            if (Fact_Accumulation_ID < 1) throw new ArgumentException("Fact_Accumulation_ID is mandatory.");
            Set_ValueNoCheck("Fact_Accumulation_ID", Fact_Accumulation_ID);
        }
        /** Get Balance Aggregation.
        @return Balance Aggregation */
        public int GetFact_Accumulation_ID()
        {
            Object ii = Get_Value("Fact_Accumulation_ID");
            if (ii == null) return 0;
            return Convert.ToInt32(ii);
        }
        /** Set Activity.
        @param IsActivity Activity */
        public void SetIsActivity(Boolean IsActivity)
        {
            Set_Value("IsActivity", IsActivity);
        }
        /** Get Activity.
        @return Activity */
        public Boolean IsActivity()
        {
            Object oo = Get_Value("IsActivity");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Budget.
        @param IsBudget Budget */
        public void SetIsBudget(Boolean IsBudget)
        {
            Set_Value("IsBudget", IsBudget);
        }
        /** Get Budget.
        @return Budget */
        public Boolean IsBudget()
        {
            Object oo = Get_Value("IsBudget");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Business Partner.
        @param IsBusinessPartner Business Partner */
        public void SetIsBusinessPartner(Boolean IsBusinessPartner)
        {
            Set_Value("IsBusinessPartner", IsBusinessPartner);
        }
        /** Get Business Partner.
        @return Business Partner */
        public Boolean IsBusinessPartner()
        {
            Object oo = Get_Value("IsBusinessPartner");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Campaign.
        @param IsCampaign Campaign */
        public void SetIsCampaign(Boolean IsCampaign)
        {
            Set_Value("IsCampaign", IsCampaign);
        }
        /** Get Campaign.
        @return Campaign */
        public Boolean IsCampaign()
        {
            Object oo = Get_Value("IsCampaign");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Default.
        @param IsDefault Default value */
        public void SetIsDefault(Boolean IsDefault)
        {
            Set_Value("IsDefault", IsDefault);
        }
        /** Get Default.
        @return Default value */
        public Boolean IsDefault()
        {
            Object oo = Get_Value("IsDefault");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Location From.
        @param IsLocationFrom Location From */
        public void SetIsLocationFrom(Boolean IsLocationFrom)
        {
            Set_Value("IsLocationFrom", IsLocationFrom);
        }
        /** Get Location From.
        @return Location From */
        public Boolean IsLocationFrom()
        {
            Object oo = Get_Value("IsLocationFrom");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Location To.
        @param IsLocationTo Location To */
        public void SetIsLocationTo(Boolean IsLocationTo)
        {
            Set_Value("IsLocationTo", IsLocationTo);
        }
        /** Get Location To.
        @return Location To */
        public Boolean IsLocationTo()
        {
            Object oo = Get_Value("IsLocationTo");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Product.
        @param IsProduct Product */
        public void SetIsProduct(Boolean IsProduct)
        {
            Set_Value("IsProduct", IsProduct);
        }
        /** Get Product.
        @return Product */
        public Boolean IsProduct()
        {
            Object oo = Get_Value("IsProduct");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Project.
        @param IsProject Project */
        public void SetIsProject(Boolean IsProject)
        {
            Set_Value("IsProject", IsProject);
        }
        /** Get Project.
        @return Project */
        public Boolean IsProject()
        {
            Object oo = Get_Value("IsProject");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Sales Region.
        @param IsSalesRegion Sales Region */
        public void SetIsSalesRegion(Boolean IsSalesRegion)
        {
            Set_Value("IsSalesRegion", IsSalesRegion);
        }
        /** Get Sales Region.
        @return Sales Region */
        public Boolean IsSalesRegion()
        {
            Object oo = Get_Value("IsSalesRegion");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set User Element 1.
        @param IsUserElement1 User Element 1 */
        public void SetIsUserElement1(Boolean IsUserElement1)
        {
            Set_Value("IsUserElement1", IsUserElement1);
        }
        /** Get User Element 1.
        @return User Element 1 */
        public Boolean IsUserElement1()
        {
            Object oo = Get_Value("IsUserElement1");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set User Element 2.
        @param IsUserElement2 User Element 2 */
        public void SetIsUserElement2(Boolean IsUserElement2)
        {
            Set_Value("IsUserElement2", IsUserElement2);
        }
        /** Get User Element 2.
        @return User Element 2 */
        public Boolean IsUserElement2()
        {
            Object oo = Get_Value("IsUserElement2");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set User List 1.
        @param IsUserList1 User List 1 */
        public void SetIsUserList1(Boolean IsUserList1)
        {
            Set_Value("IsUserList1", IsUserList1);
        }
        /** Get User List 1.
        @return User List 1 */
        public Boolean IsUserList1()
        {
            Object oo = Get_Value("IsUserList1");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set User List 2.
        @param IsUserList2 User List 2 */
        public void SetIsUserList2(Boolean IsUserList2)
        {
            Set_Value("IsUserList2", IsUserList2);
        }
        /** Get User List 2.
        @return User List 2 */
        public Boolean IsUserList2()
        {
            Object oo = Get_Value("IsUserList2");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
    }

}
